﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cinemax.DAO;
namespace Cinemax.Ajax
{
    public partial class ajax_login : System.Web.UI.Page
    {
        public string value = "";
        public bool temp = false;
        public string url = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["username"] != null && Request.QueryString["password"] != null)
            {
                string username = (string)Request.QueryString["username"].Trim();
                string password = (string)Request.QueryString["password"].Trim();
                string maSuatChieu = Session["msc"].ToString();
                string maPhongChieu = Session["mp"].ToString();
                string maVe = (string)Request.QueryString["ve"].Trim();
                
                int a = TaiKhoanDAO.CheckLogin(username, password);
                if (a != -1)
                {
                    temp = true;
                    Session["user_login"] = a;
                    value = "Đăng nhập thành công";
                    url = "submit.aspx?" + "sc=" + maSuatChieu + "&pc=" + maPhongChieu + "&ve=" + maVe;
                }
                else
                {
                    value = "Đăng nhập không thành công";
                    temp = false;
                }
            }
        }
    }
}